/* header */ var cyHeader = function () { var _cyNav = $('.cy-nav'), _cyNavList =$('.cy-nav>li'); var _cyTimer; _cyNavList.each(function () { var _this = $(this), _thisNav2 = _this.find('.cy-nav2'); _this.on({ mouseenter: function () { _thisNav2.stop(false, true); _cyTimer = setTimeout(function () { _this.addClass('cy-active').siblings().removeClass('cy-active'); _thisNav2.stop().slideDown(); }, 100); }, mouseleave: function () { clearTimeout(_cyTimer); if (_this.hasClass('cy-active') && _this.find('ul').hasClass('cy-nav2')) { _thisNav2.stop().slideUp(function () { _this.removeClass('cy-active'); }); } else { _this.removeClass('cy-active'); } } }); }); }; var cyHeaderM = function () { var _cyHeaderReal = $('.cy-headerReal'), _cyHeaderMenu = $('.cy-nav-menu'), _cyHeaderNav = $('.cy-nav'), _cyHeaderNavLink = $('.cy-nav>li'), _cyLogo = $('.cy-logo'), _cyHeaderCtc = $('.cy-header-ctc'); _cyHeaderNav.before('
'); _cyLogo.appendTo($('.cy-m-header')); _cyHeaderMenu.appendTo($('.cy-m-header')); _cyHeaderMenu.on({ click: function () { var _this = $(this); if(!_this.hasClass('cy-active')) { _this.addClass('cy-active'); _cyHeaderNav.slideDown(function () { $('.cy').css({ 'height': _cyHeaderReal.outerHeight() + _cyHeaderNav.outerHeight() }); _cyHeaderCtc.slideDown(); }); } else { _this.removeClass('cy-active'); _cyHeaderCtc.slideUp(function () { _cyHeaderNav.slideUp(); }); } } }); _cyHeaderNavLink.on({ click: function () { var _this = $(this); if(!_this.hasClass('cy-active')) { _this.addClass('cy-active').siblings().removeClass('cy-active').find('.cy-nav2').slideUp(); _this.find('.cy-nav2').slideDown(function () { $('.cy').css({ 'height': _cyHeaderReal.outerHeight() + _cyHeaderNav.outerHeight() }); }); } else { _this.removeClass('cy-active'); _this.find('.cy-nav2').slideUp(); } _this.find('.cy-nav2').siblings('a').removeAttr('href'); } }); }; function cyHeaderShow() { var _cyHeader = $('.cy-header'), _cyHeaderReal = $('.cy-headerReal'); if ($(window).width() < 992) { cyHeaderM(); } else { cyHeader(); } _cyHeader.height(_cyHeaderReal.outerHeight()); $(window).resize(function () { _cyHeader.height(_cyHeaderReal.outerHeight()); }); if ($(window).scrollTop() > 0) { _cyHeaderReal.addClass('cy-fixed'); } else { _cyHeaderReal.removeClass('cy-fixed'); } $(window).scroll(function () { if ($(window).scrollTop() > 0) { _cyHeaderReal.addClass('cy-fixed'); } else { _cyHeaderReal.removeClass('cy-fixed'); } }); } /* header end */ /* footer */ var cyFooter = function () { var _cyCtcWay = $('.cy-ctcWay'); var _cyPhone = _cyCtcWay.find('.cy-phone a'), _cyAddress = _cyCtcWay.find('.cy-address a'); _cyPhone.attr("href", "tel:" + _cyPhone.text()); _cyAddress.attr("href", "http://map.baidu.com/?newmap=1&ie=utf-8&s=s%26wd%3D" + _cyAddress.text()); }; /* footer end*/ /* to top */ var cyToTop = function () { var _cyToTop = $('.cy-toTop'); var _isFinish = true; _cyToTop.on({ click: function () { if (_isFinish) { $('html, body').animate({ scrollTop: 0 }, 380, function () { _isFinish = true; }); _isFinish = false; } } }); _cyToTopShow(); $(window).scroll(function () { _cyToTopShow(); }); function _cyToTopShow() { if ($(window).scrollTop() < $(window).height() / 2) { _cyToTop.fadeOut(); } else { _cyToTop.fadeIn(); } } }; /* to top end */ /* zhao pin */ var cyZhp = function () { var _cyZhpL = $('.cy-tlRc li'); _cyZhpL.each(function () { var _this = $(this), _thisCont = _this.find('.cy-tlRc-cont'), _h, _height, _index; _this.on({ mouseenter: function () { if (_thisCont.css('display') == 'none') _thisCont.addClass('cy-ready-show'); }, mouseleave: function () { _thisCont.removeClass('cy-ready-show'); }, click: function () { if (_thisCont.hasClass('cy-ready-show')) { _h = _this.siblings("li.cy-active").find('.cy-tlRc-cont').outerHeight() || 0; _height = _this.offset().top - $(".cy-header").height(); _index = _this.index() - _this.siblings(".cy-active").index(); _this.siblings(".cy-active").removeClass('cy-active').find('.cy-tlRc-cont').slideUp(function () { $(this).addClass('cy-ready-show'); }); _this.addClass('cy-active'); _thisCont.slideDown(function () { $(this).removeClass('cy-ready-show'); }); $("html, body").animate({ scrollTop: _index > 0 ? _height - _h : _height }); } else { _this.removeClass('cy-active'); _thisCont.slideUp(function () { $(this).addClass('cy-ready-show'); }); } } }); }); }; /* zhao pin end */ /* common function to show */ var cyCommonShow = function () { cyHeaderShow(); cyFooter(); cyToTop(); }; if(navigator.userAgent.indexOf("MSIE") != -1) { $('head').append("" + ""); } /* common function to show end */ // ajax to add common style cyCommonShow(); $(".add-join-box .join-close").on("click",function() { $(this).parent().fadeOut(); }); var pageInit ={ videoShow: function () { $(".video-sbtn").on("click",function () { var videoName = $(this).data('video'); $(".videon").attr("src", videoName); $(".pvideo-bg").addClass("overlay"); }); $(".pv-close").on("click",function () { $(".pvideo-bg").removeClass("overlay"); $(".videon").attr("src", ""); }); $(".vwrap .close,.vwrap .videobtg").on("click",function () { $(".vwrap").hide(); $('#videobox').html(""); }); } } pageInit.videoShow();